package ai.people.netmon.framework.domain.warning.request.label;

import ai.people.netmon.framework.domain.warning.entity.WarningLabelTree;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author zhenglin
 * @since 2022-07-19
 */
@Data
@NoArgsConstructor
public class WarningLabelTreeVO implements Serializable {

    /**
     * 主键ID
     */
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long id;

    /**
     * 父ID 0为根节点
     */
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long parentId;

    /**
     * 标签名
     */
    private String labelName;

    /**
     * 标签值
     */
    private String labelValue;

    private Integer type;

    /**
     * 子节点数量
     */
    private Integer childrenCnt;

    /**
     * 子节点
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private List<WarningLabelTreeVO> children;

    public WarningLabelTreeVO(WarningLabelTree root) {
        this.id = root.getId();
        this.parentId = root.getParentId();
        this.labelName = root.getLabelName();
        this.labelValue = root.getLabelValue();
        this.type = root.getType();
    }
}
